const mongoose = require('mongoose');
const { getMeta, preSave } = require('../helpers');

/** 定义 User Schema */
const UserSchema = new mongoose.Schema({
  username: String,
  password: String,
  /** 角色 */
  character: String,
  meta: getMeta(),
});

UserSchema.pre('save', preSave);

/** 注册 User shecma */
const UserModel = mongoose.model('User', UserSchema);
